package io.renren.modules.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.dao.BsRoomDao;
import io.renren.modules.dto.BsRoomDTO;
import io.renren.modules.entity.BsRoomEntity;
import io.renren.modules.service.BsRoomService;
import cn.hutool.core.util.StrUtil;
import io.renren.modules.vo.BsProductVO;
import io.renren.modules.vo.BsRoomVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 房间编号
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2024-05-27
 */
@Service
public class BsRoomServiceImpl extends CrudServiceImpl<BsRoomDao, BsRoomEntity, BsRoomDTO> implements BsRoomService {

    @Resource
    BsRoomDao bsRoomDao;

    @Override
    public QueryWrapper<BsRoomEntity> getWrapper(Map<String, Object> params) {
        String id = (String) params.get("id");

        QueryWrapper<BsRoomEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);

        return wrapper;
    }

    @Override
    public List<BsRoomVO> listRoom() {
        List<BsRoomVO> listRoom = bsRoomDao.listRoom();
        return listRoom;
    }

    @Override
    public List<BsProductVO> listProductByRoomNo(String roomNo) {
        List<BsProductVO> listProductByRoomNo = bsRoomDao.listProductByRoomNo(roomNo);
        return listProductByRoomNo;
    }
}